home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / zines / Happle / happle10.sit.hqx / Happle#10 / Happle Issue#10.rsrc / TEXT_152.txt < prev    next >
Text File  |  1999-06-11  |  18KB  |  112 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Cryptography
  8.  
  9. Written By A.Forster of [ACI] Database
  10.  
  11. Table of Contents
  12. ~~~~~~~~~~~~~~~~~
  13.  o  1 - Introduction
  14.  o  2 - Crypto-Misconceptions
  15.  o  3 - What makes an algorithm insecure?
  16.  o  4 - What Makes a Strong Cryptographic Algorithm?
  17.  o  5 - Overview of modern cryptographic systems
  18.  
  19.  
  20. Introduction
  21. ~~~~~~~~~~~~
  22. I just finished reading a book the other night.  The author, Dr. David Brin raised the question that, if the future society truly wants freedom, privacy can only be counter-productive.  Brin suggests that regardless of how much society gravitates toward encryption and secrecy, there will always be a class of people who will be able to manipulate and overcome the common citizen‚Äôs attempts at privacy.  This class of people include governments, terrorists, and the technologically elite class, otherwise called hackers.  The author suggests that that society should move toward openness rather than secrecy.  It is the only way that people can be held accountable for their actions.  The only problem with Brin‚Äôs proposal is that people will never agree that an open society is the answer.  Americans hold their right to keep secrets and protect themselves with encryption and concealment to be fundamental, they will not likely allow it to be taken away from them.  While I agree that Brin‚Äôs ideas are very well founded and were conceived with the best of intentions, I don‚Äôt think that they will become reality within my lifetime or the following few generations.
  23.  
  24. As a result of my opinion I‚Äôve taken a fair amount of interest in the field of cryptography.  My reasoning is that I may as well familiarize myself with something that will be in use all over the world by the time I‚Äôm thirty years old.  I‚Äôve spent quite a few hours sifting through the net in search of information on cryptography, and, while I‚Äôve found much that‚Äôs been of use to me, there is a majority of information on the net and in books that is completely useless.  The same is true for encryption/decryption applications.  There are some programs that will give your information a great deal of security, while other applications, which may seem secure, in fact provide little to no protection at all against anyone familiar with modern cryptography.  The goal of this paper is to provide the highly esteemed Happle reader with a comprehensive overview of modern cryptography as well as what makes cryptographic algorithms secure or insecure.
  25.  
  26.  
  27. Cryptographic Misconceptions
  28. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  29. After having gone through most of the Freeware and Shareware cryptography application available to the general public, I‚Äôve got a decent understanding of what mistakes people are making when writing cryptography software.  The most common of developer blunder is to assume that if your result after encrypting looks absolutely nothing like the original text, your program can secure data.  I‚Äôve had people tell me that their algorithm is amazing because their math teacher couldn‚Äôt figure out what the cipher text was before it was encrypted.  It doesn‚Äôt matter how well your math teacher knows their multiplication tables people, their crypt analysis skills are nothing compared to a half-decent cipherPunk and their old ThinkC compiler.  The first thing you have to ask yourself is this:  ‚ÄúIf I gave someone all the source code for my encryption program, would it still be nearly impossible for them to crack in less than a year?‚Äù  If you can‚Äôt give out your crypto-source code because it might compromise the security of your program, then it was never secure in the first place.  Modern ciphers don‚Äôt hide what they‚Äôre doing for people.  The ciphers being developed in this decade rely on making themselves impractical to compromise.  The algorithms are based on keys and passphrases while using standard manipulation methods.  The result is encrypted data which has a number of possible origins that is directly proportional to the size of the key used (the ‚Äòkeyspace‚Äô) or the length and discretionary nature of the passphrase that the user has chosen.  I realize I may be losing you due to the completely bland nature this paragraph has adopted so I‚Äôll give you a few visual examples.
  30.  
  31. ex1.
  32. An example of a very poor algorithm is one that doesn‚Äôt change the method of encryption depending on a user entered passphrase or keyspace.
  33.  
  34. Suppose an algorithm is handed a text with the following string:  ‚ÄòBushido Cyberspace‚Äô  The algorithm takes each letter and adds ‚Äò5‚Äô to the ascii value of the original letter.  (By the way, Bushido IS a word.) The result is as follows:  ‚ÄòGzxmnit Hdgjwxufhj‚Äô   Certainly, at first glance, the result is unreadable, it‚Äôs even conceivable that many people would be unable to determine the original text given the resulting cipher text.  Now suppose the algorithm exchanges the placing of the two words and reverses everything except the capital letters.  The result would be: 
  35. ‚ÄòHjhfuxwjgd Gtinmxz‚Äô  now if someone were to try only an alphabetic shift approach to determining the original text, they would not get the correct result.  They would get the correct letters, but not the correct positioning.  Now for the final assumption in this example.  Let‚Äôs assume that you tell your math teacher: ‚ÄúI shifted the ascii values and I also shifted the position of ‚Äòsome‚Äô of the letters‚Äù  Well if you had a half decent math teacher then he or she would likely smack you in the head.  It would simply take them too long to sit down and try all of the possible combinations (there are far more than 10,000 possibilities.)  If we assume that your math teacher can work out 5 solutions every ten minutes, it would still take him or her over 14 days to find an answer.  That‚Äôs not including time for eating, sleeping, or hanging out on Hotline.  So most people stop at this point.  They say to themselves, or to an admin on [ACI] ‚ÄúHey, my math teacher can‚Äôt figure it out, so it‚Äôs secure.‚Äù  
  36. Well, not quite kid.  I have to get back to the cipherPunk and their C compiler.  If you tell a cPunk what you told your teacher about the algorithm, it might take them an hour and a half to write a program to crack your algorithm, and the computer would do the rest of the work in about 5 minutes.  Then, once they find out exactly how your algorithm works (how you reposition the letters) they can write another program in five minutes to crack anything you encrypt in under 10 seconds.  Then they can distribute the program and the weeks of work that you poured into your ‚Äòsecure‚Äô algorithm just serve as a reminder that you‚Äôre not very good at coding secure algorithms.  But that won‚Äôt happen now that you‚Äôve read this paper.
  37.  
  38.  
  39. What makes an algorithm insecure?
  40. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  41. First of all, I‚Äôm not sure what kind of reader you are, so let me step back an inch or so and explain what I‚Äôm talking about here.  A cipher is generally thought of as a self contained set of code which, when put to use, can encrypt and decrypt information.  Ciphers depend on mathematical algorithms, which are sections of code that manipulate the data.  Algorithms are usually long, drawn out, mathematical sets which can take the phrase ‚ÄúHello world!‚Äù and turn it into a 35 character set of random numbers and letters.  It‚Äôs usually accompanied by a sister-algorithm that reverses the process.  Ok, well now that algorithms have been defined, let‚Äôs explore what makes certain algorithms useless.  As you saw in the last section, an algorithm is insecure if it was designed to elude people.  Hiding things in your socks eludes most people; so if your algorithm is over their heads don‚Äôt be too impressed with yourself.  You have to realize that you‚Äôre up against a computer, a smart crypto-elite programmer, and possibly a few of his friends‚Äô processors.  The average modern computer can chug through your algorithm, processing thousands of possible outcomes and original texts every second.  If the algorithm is based mainly on methods of moving the text around, then you probably won‚Äôt get much more than 10-20 million possibilities.  A single modern computer can crack an algorithm like that in about an hour and a half.  (Though that might be giving the algorithm a bit too much credit.)  There are other algorithms that do base their methods of encryption on passphrases and keys.  If there is a single flaw in the design of the algorithm‚Äôs security, the cipher can likely be compromised before it‚Äôs a week old.  Let me show you an example of an advisory I wrote for a terribly insecure cipher released not too long ago.
  42.  
  43.  
  44. [advanced computing information database]
  45.  
  46. Advisory for:
  47. mSec Crypt() (no version number specified in the application)
  48.     /************************************************************************/
  49. One of the tests
  50. /************************************************************************/
  51.  
  52. I encrypted approximately 10 different plaintexts 3 times each with varying passwords and varying program settings.  The test which shows the flaws most apparently is below.
  53.  
  54.  
  55. The plaintext I encrypted is as follows:
  56.  
  57. abcdefghijklmnopqrstuvwxyz
  58. 1234567890
  59.  
  60.  
  61. When encrypted with the most secure key that the program offers the result is as follows:
  62.  
  63. -- Begin mSec Private Key Encrypt --
  64.  
  65. KJIHGFEDCBA@?>=<;:987654321{zyxwvuts
  66.  
  67. -- End mSec Private Key Encrypt ---
  68.  
  69.  
  70. Alright, so in this case I just ran a string of sequential characters through the cipher on it‚Äôs most ‚Äòsecure‚Äù setting and, as soon as I saw the result, I knew what sort of algorithm was used to encrypt the text.  The original text is just reversed and the ASCII value is shifted over according to the value of the passphrase entered.  The problem with this is that there are less than 256 possibilities for the ascii shift.  Regardless of how long it might take a person to calculate all of the possibilities, a computer program can take all of these possibilities in a fraction of a second.
  71.  
  72.  
  73. What Makes a Strong Cryptographic Algorithm?
  74. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  75. Since I‚Äôve given some explanation on what makes an algorithm insecure, I‚Äôll move on to the features and characteristics of a  potentially secure cipher.  While I might have been a bit hard on the importance of a cipher‚Äôs potential entropy in the last chapter, we must all be aware that it is, of course, the basis of encryption technology to make the data impossible to read by humans.  What strong algorithms take into account is that they now have to make the data impossible to be read by some of the new computer processors as well.  So the modern algorithms perform enough of a pass-phrase modification to make the result almost entirely different from the original.  There are a few standard methods of getting this done, I‚Äôll outline the most used below.
  76.  
  77.  o  Permutation
  78.  
  79. Suppose a message is as follows:  ‚ÄúNeural_Arcology‚Äù  A permutation separates an original text into sections of approximately 5-10 characters and then changes the position of a number of letters.  If we performed a permutation on the above phrase using blocks of 5 characters then the result might be as follows:  ‚ÄúaureNcAr_lyoglo‚Äù  The developers would refer to this as a 5_53421 permutation.  The string of 5 digits referring to the positions of the original characters after the permutation.
  80.  
  81.  o  Blocking
  82.  
  83. Suppose a message is as follows: ‚Äúvacant panda motel‚Äù  Blocking involves designating sections of the original text to numbered blocks, after which, each block has its position rearranged by the algorithm.  Blocking the above phrase into sections of three characters and rearranging it gives the following result: ‚Äúndavac patlant mo‚Äù
  84.  
  85.  o  Substitution & Shift  operations
  86.  
  87. Substitution operations simply substitute a specified set of characters for the original characters which are to be encrypted.  The phrase ‚ÄúDave, are you there?‚Äù might become 
  88. ‚Äúhrksl res wiv m,seso‚Äù
  89.  
  90. Many people use these functions in conjunction with a passphrase and consider the entire application to be secure.  Well, these people still have a lot to learn.  If you want to code a fairly secure cipher then you‚Äôll need to use (most likely) all of these functions, as well as other similar functions.  You‚Äôll need to use them more than once each time you encrypt, and layer them so that the result of the encryption is completely different both in size, character sets, and location of charcters.  It is also important that as many functions as possible rely on a user-entered passphrase to get the work done.  
  91.  
  92. The manner in which the passphrase influences the various functions is of vital importance.  A good cipher will make sure that a message encrypted with the passphrasem ‚Äúhello‚Äù is very different from a message that is encrypted with ‚Äúhellp‚Äù (‚Äòp‚Äô being one letter after ‚Äòo‚Äô in the alphabet  =)  How does an algorithm accomplish this in an effective manner?  Usually it expands the passphrase to a much larger size.   A good passphrase algorithm can take the word ‚ÄúDataNaga‚Äù  and expand it to a 2000 character set of random characters.  The algorithm can then substitute according to the expanded passphrase with much more effectiveness.
  93.  
  94.  
  95. Overview of Modern Cryptographic Systems
  96. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  97. There are a few generally accepted standard forms of cryptography.  These are standard forms of encrypting/decrypting and communicating over private channels.  The two largest such forms of cryptographic systems are -Symmetric Key algorithms-  and -Public Key algorithms-
  98.  
  99.  o  Symmetric Key Cryptography
  100.  
  101. This form of encryption sets up a model in which a key is used to encrypt data.  The party that wishes to decrypt that data must use the original key, the one that was used to encrypt, in order to return the ciphertext into the original legible data. So suppose we have two people, Bob and Alice, and they would like to use encryption to hide evidence of their affair.  Bob and Alice meet in a Starbuck‚Äôs coffee and, on their TI85 calculator, come up with a big page-long key that they can use to encrypt materials later on.  They go back to their homes and Bob encrypts his love letter using the agreed upon key.  He transmits the encrypted data over the internet and Alice eventually decrypts the letter using the same key.  There is a flaw in this protocol however.  Let‚Äôs suppose that Susan, Bob‚Äôs legal wife, knows a bit about computers as well.  Susan could take Bob‚Äôs key from his computer, or she could bribe the kid at Starbucks for the security camera‚Äôs tape which clearly shows the key that Bob and Alice worked on.  Now Susan can read everything that Bob sends Alice, as well as everything that Alice sends Bob.   (Never mind that she could just use the tape of them in a Starbucks as proof of the affair, this is a paper on cryptography.)
  102.  
  103.  o  Public Key Cryptography
  104.  
  105. This is the form of encryption that both governments and the technologically elite have accepted as the standard in ultimate cryptographic security.  Let me explain the protocol to you.  This time Bob has learned from his earlier mistake. (Not the cheating part, but using a symmetric algorithm)  So he and his new lover, Denise, use a public key cryptographic algorithm to keep their affair secret.  Bob and Denise both download a copy of PGP and when they start the program it creates a pair of keys for both of them.  One of the keys is known as a Public Key and the other is a Private Key.  Later that evening, Bob encrypts some more love letters to Denise using her public key.  What it‚Äôs important to realize at this point is that a message encrypted with Denise‚Äôs public key can only be decrypted with her private key.  Denise keeps her private key stored in a safe place and she‚Äôs the only person who needs to know its location.  So she receives Bob‚Äôs letters and uses her private key to decrypt them.  She writes a reply and encrypts it with Bob‚Äôs public key (public keys are freely available and can be given to anyone.  No message can be decrypted with a public key)  And Bob decrypts the message with his private key.  And the process repeats.  There is no room in this protocol to allow for Susan, the jealous wife, to find out what they‚Äôre saying to each other, because each time they decrypt messages with a private key, they also need to enter a passphrase (approximately 4 or 5 words) in order for the private key to work.  Since Bob and Denise both store their passphrases in their heads like good little computer users should, there is no way (short of installing home video cams) for Susan to interrupt Bob‚Äôs adulterous habits.  Things to keep in mind:  Public key cryptography uses keys with enough complexity to allow for 2^64 possible keys.  That‚Äôs a number with over 60 digits for the people that don‚Äôt know what exponents are.
  106.  
  107.  
  108. Brief Conclusion
  109. ~~~~~~~~~~~~~~~~
  110. I sympathize with David Brin‚Äôs concern for a society shrouded in secrecy, but I cannot escape reality, and therefore, the fact that privacy is the inevitable future for computer users.  It‚Äôs important that more people involve themselves in the field and that they stop producing applications which provide less security than hiding your life savings under your mattress.  When you develop cryptography applications in the future you should now have a half decent idea of what is secure and what is insecure.  you should be aware that your opponents are not people wearing neckties, hoping to crack your algorithm with a pencil, paper, and an iron will.  Your opponents are computers; capable of thousands upon thousands of calculations per second.  There‚Äôs no problem with coming up with algorithms that can only be secure if they‚Äôre secret.  Algorithms like that can be decent fun and they‚Äôre a challenge to write, just don‚Äôt expect them to keep your data safe.  Also, don‚Äôt expect any of the low-end shareware applications to keep your texts safe, the only thing I‚Äôd trust with my files is PGP or Blowfish.  But on the other hand, I don‚Äôt have anything to hide.
  111.  
  112.